package com.example.WebSocketDemo.service.impl;

import com.example.WebSocketDemo.bean.Message;
import com.example.WebSocketDemo.mapper.MessageMapper;

import com.example.WebSocketDemo.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("messageService")
public class MessageServiceImpl implements MessageService {
    @Autowired
    private MessageMapper messageMapper;
    @Override
    public void insertMessage(Message message) {
        messageMapper.insertMessage(message);
    }

    @Override
    public void insertUnReadMessage(Message message) {
        messageMapper.insertUnReadMessage(message);
    }

    @Override
    public List<Message> getMessageByFromUserAndToUserAndChatType(String from, String to, String type) {

        return messageMapper.getMessageByFromUserAndToUserAndChatType(from,to,type);
    }

    @Override
    public Message getRecentMessage(String username, String friendName) {
        return null;
    }

    @Override
    public List<Message> getUnAcceptedMessage(String username) {
        return messageMapper.getUnAcceptedMessage(username);
    }

    @Override
    public void updateUnReadMessage(String username) {
        messageMapper.updateUnReadMessage(username);
    }
}
